package org.zyj.io.example.buf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

import java.nio.charset.StandardCharsets;

/**
 * 创建堆外内存区域的bytebuf
 */
public class NettyByteBuf03 {

    public static void main(String[] args) {
        ByteBuf byteBuf = Unpooled.directBuffer(16);
        byteBuf.writeByte(1);
        byteBuf.writeByte(2);
        byteBuf.writeByte(3);
        System.out.println(byteBuf.readByte());
        System.out.println(byteBuf.readByte());
        System.out.println(byteBuf.readByte());
        System.out.println(byteBuf);
    }
}
